﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MobileSales.Model.Orders;
using MobileSales.Model.Exceptions;

namespace MobileSales.Server.Services
{
    [ServiceContract]
    public interface IOrderService
    {
        #region Order management

        [OperationContract]
        Order GetOrder(int orderId);
        [OperationContract]
        IEnumerable<Order> GetOrderList();
        [OperationContract]
        IEnumerable<Order> GetFilteredOrderList(int? orderStatusId, int? orderClientId, DateTime? startDate, DateTime? endDate);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreOrder(Order order);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteOrder(int orderId);

        #endregion

        #region Order item management

        [OperationContract]
        OrderItem GetOrderItem(int orderItemId);
        [OperationContract]
        IEnumerable<OrderItem> GetOrderItemList(int orderId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreOrderItem(OrderItem orderItem);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteOrderItem(int orderItemId);

        #endregion

        #region Order status management

        [OperationContract]
        OrderStatus GetOrderStatus(int orderStatusId);
        [OperationContract]
        IEnumerable<OrderStatus> GetOrderStatusList();
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreOrderStatus(OrderStatus orderStatus);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteOrderStatus(int orderStatusId);

        #endregion
    }
}
